<template>
	<view>
		<view style="margin-left: 42rpx;margin-top: 100rpx;">
			<view style="position: relative;">
				<image class="img" src="../../../static/default.png" mode=""></image>
				<text class="text">发起申请</text>
			</view>
			<view class="pob">
				<view class="graytext">
					申请说明:{{introText}}
				</view>
				<view class="graytexts">
					时间:{{cancelDate}}
				</view>
				<view v-if="schedule==1" class="graytexts">
					<button @click="withdraw" class="withdraw">撤回</button>
				</view>
			</view>
		</view>

		<view style="margin-left: 42rpx;">
			<view style="position: relative;">
				<image v-if="schedule==1" class="img" src="../../../static/reviewing.png" mode=""></image>
				<image v-if="schedule==2||schedule==3" class="img" src="../../../static/default.png" mode=""></image>
				<text v-if="schedule==1" class="text">审核中</text>
				<text v-if="schedule==2||schedule==3" class="text">审核</text>
			</view>
			<view class="pobs" v-if="schedule==1">
				<view v-if="schedule==1" class="graytexts">
					审核中约需1~3个工作日
				</view>
				<view v-if="schedule==4" class="graytexts">
				</view>
				<view v-if="schedule==2||schedule==3" class="graytexts">
					审核时间：{{auditDate}}
				</view>
			</view>
			<view class="pob" v-if="schedule==2||schedule==3">
				<view v-if="schedule==1" class="graytext">
					审核中约需1~3个工作日
				</view>
				<view v-if="schedule==4" class="graytext">
				</view>
				<view v-if="schedule==2||schedule==3" class="graytexts">
					审核时间：{{auditDate}}
				</view>
			</view>
			<view class="pob2" v-if="schedule==4">
				<view v-if="schedule==1" class="graytext">
					审核中约需1~3个工作日
				</view>
				<view v-if="schedule==4" class="graytext">
				</view>
				<view v-if="schedule==2||schedule==3" class="graytext">
					审核时间：{{auditDate}}
				</view>
			</view>
		</view>

		<view style="margin-left: 42rpx;">
			<view style="position: relative;">
				<image v-if="schedule==2" class="img" src="../../../static/default.png" mode=""></image>
				<image v-else class="img" src="../../../static/result.png" mode=""></image>
				<text v-if="schedule== 1" class="texts">审核结果</text>
				<text v-else class="text">审核结果</text>

				<view style="margin-left: 23rpx;padding-top: 30rpx;">
					<view v-if="schedule== 2" class="graytext">
						已注销:
					</view>
					<view v-if="schedule== 4" class="graytext">
						已撤销:
					</view>
					<view v-if="schedule== 3" class="graytext">
						已驳回:{{auditDate}}
					</view>
					<view v-if="schedule== 3" class="graytext">
						驳回原因:{{auditMsg}}
					</view>
				</view>
			</view>
		</view>
		<u-popup v-model="show" mode="center" border-radius="14">
			<div class="chexiao-wrapper">
				<text class="title">撤销申请后，恢复原合伙人身份</text>
				<view class="buttons-wrapper">
					<div class="button cancel" @click="cancle">取消</div>
					<div class="button sure" @click="sure">确定</div>
				</view>
			</div>
		</u-popup>
	</view>
</template>
<script>
	import {
		cancellationPage,
		cancellationSubmit
	} from "@/api/members.js";
	import storage from "@/utils/storage.js"
	export default {
		data() {
			return {
				show: false,
				id: '', //审核表id
				schedule: 0,
				userInfo: '',
				introText: '',
				cancelDate: '',
				auditDate: '',
				auditMsg: ''
			}
		},
		onLoad() {
			this.userInfo = storage.getUserInfo()
			this.getProgress()
		},
		methods: {
			getProgress() {
				cancellationPage().then((res) => {
					if (res.data.success) {
						this.id = res.data.result.id
						this.introText = res.data.result.revokeMsg
						this.schedule = res.data.result.auditStatus
						this.cancelDate = res.data.result.createTime
						this.auditDate = res.data.result.auditDate
						this.auditMsg = res.data.result.auditMsg
					}
				})
			},
			withdraw() {
				this.show = true
			},
			sure() {
				cancellationSubmit({
					auditId: this.id,
				}).then((res) => {
					if (res.data.success) {
						uni.showToast({
							title: "撤回成功!",
							duration: 2000,
							icon: "none",
						});
						setTimeout(() => {
							uni.navigateBack({
								delta: 1
							})
						}, 2000)
					} else {
						uni.showToast({
							title: "撤回失败!",
							duration: 2000,
							icon: "none",
						});
					}
				})
			},
			cancle() {
				this.show = false
			}
		}
	}
</script>
<style lang="scss" scope>
	.img {
		height: 46rpx;
		width: 46rpx;
		position: absolute;
		top: -5rpx;
	}

	.pob {
		/* width: 342px; */
		border-left: rgba(54, 64, 255, 1) 2px solid;
		/* height: 200rpx; */
		margin-left: 23rpx;
		padding-top: 30rpx;
	}

	.pob2 {
		/* width: 342px; */
		border-left: rgba(212, 212, 212, 1) 2px solid;
		/* height: 200px; */
		margin-left: 23rpx;
		padding-bottom: 300rpx;
	}

	.pobs {
		/* width: 342px; */
		border-left: rgba(212, 212, 212, 1) 2px solid;
		/* height: 200rpx; */
		margin-left: 23rpx;
		padding-top: 30rpx;
	}

	.withdraw {
		/* margin-top: 20rpx; */
		float: left;
		height: 40rpx;
		line-height: 40rpx;
		color: rgba(230, 214, 172, 1);
		font-size: 20rpx;
		border: 2rpx solid rgba(230, 214, 172, 1);
		border-radius: 22rpx;
		width: 100rpx;
	}

	.text {
		padding-left: 90rpx;
		color: rgba(54, 64, 255, 1);
		font-weight: 400;
		height: auto;
	}

	.texts {
		padding-left: 90rpx;
		color: rgba(212, 212, 212, 1);
		font-weight: 400;
		height: auto;
	}

	.graytext {
		margin-left: 66rpx;
		color: rgba(163, 163, 163, 1);
		font-weight: 400;
		height: auto;
	}

	.graytexts {
		margin-left: 66rpx;
		color: rgba(163, 163, 163, 1);
		font-weight: 400;
		height: auto;
		padding-bottom: 80rpx;
	}

	.chexiao-wrapper {
		padding: 40upx;

		.title {
			margin: 32upx 0;
		}

		.buttons-wrapper {
			margin-top: 60upx;
			display: flex;
			justify-content: space-between;

			.button {
				width: 44%;
				height: 60upx;
				line-height: 60upx;
				text-align: center;
				border-radius: 72upx;
			}

			.sure {
				background-color: #FF946E;
				color: #ffffff;
			}

			.cancel {
				border: 2upx solid #aaaaaa ;
			}
		}
	}
</style>
